﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tedds_Tool.Instructions;
using GUI.Custom_Classes;
using LEET.CommonInterfaces;
using CommonInterfaces.Models;
using LEET.LEETCommon.Model;
using LEET.CommonInterfaces.Models;
using System.Windows;
using LEET.StandardModuals.Instructions;

namespace Tedds_Tool.Automatables.LEETModuals
{
    public class VerifyModual : ILEETModual, IHackable
    {
        private IList<ILEETHackModual> hacks;

        public VerifyModual()
        {
            hacks = new List<ILEETHackModual>();
        }

        public bool CanCompile(string instruction)
        {
            try
            {
                String [] parts = Instruction.ParseInstruction(instruction);
                return parts.Count() >= 5 && TypeName.Equals(parts[0]);
            }
            catch (InvalidInstructionException)
            {
                return false;
            }
        }

        public IInstruction CreateInstruction(string instruction)
        {
            return new Verify(Instruction.ParseInstruction(instruction), hacks);
        }

        public void LoadHack(ILEETHackModual modual)
        {
            hacks.Add(modual);
        }


        public string TypeName
        {
            get { return "VERIFY"; }
        }

        public FrameworkElement CreateScriptItemDetails(Nil onUpdate, IEnumerable<string> processes, IElementState state)
        {
            return new SI_Verify(onUpdate, state);
        }
    }
}
